<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录界面</title>
    <script type="text/javascript" src="../js/jquery.min.js"></script>
    <!-- 引入bootstarp -->
    <script type="text/javascript" src="../js/bootstrap3/js/bootstrap.js"></script>
    <link rel="stylesheet" href="../js/bootstrap3/css/bootstrap.css">
    <!-- 引入bootstrap table的css、js -->
    <link type="text/css" rel="stylesheet" href="../js/bootstrap-table/bootstrap-table.css">
    <script type="text/javascript" src="../js/bootstrap-table/bootstrap-table.js"></script>
    <script type="text/javascript" src="../js/bootstrap-table/locale/bootstrap-table-zh-CN.js"></script>
    <!-- 引入bootstrap datetime的css、js -->
    <link type="text/css" rel="stylesheet" href="../js/bootstrap-datetimepicker/css/bootstrap-datetimepicker.css">
    <script type="text/javascript" src="../js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
    <script type="text/javascript" src="../js/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>

    <!--jquery.validate-->

    <style type="text/css">
        body{background: url("../js/images/timg.png") no-repeat;background-size:cover;font-size: 16px;}
        .form{background: rgba(255,255,255,0.2);width:400px;margin:100px auto;}
        #login_form{display: block;}
        #register_form{display: none;}
        .fa{display: inline-block;top: 27px;left: 6px;position: relative;color: #ccc;}
        input[type="text"],input[type="password"]{padding-left:26px;}
        .checkbox{padding-left:21px;}
    </style>
</head>
<body background="../js/images/san.jpg" height="313" width="500">
<div class="container">
    <div class="form row">
        <form class="form-horizontal col-sm-offset-3 col-md-offset-3" id="login_form">
            <h3 class="form-title"><font color="#f0f8ff"> 登 录 你 的 账 号 </font></h3>
            <div class="col-sm-9 col-md-9">
                <div class="form-group">
                    <i class="fa fa-user fa-lg"></i>
                    <input class="form-control required" type="text" placeholder="账号" name="username" id="uname" autofocus="autofocus" maxlength="20"/>
                </div>
                <div class="form-group">
                    <i class="fa fa-lock fa-lg"></i>
                    <input class="form-control required" type="password" placeholder="密码" name="password" id="pwd" maxlength="8"/>
                </div>
                <div class="form-group">
                    <label class="checkbox">
                        <input type="checkbox" name="remember" value="1"/> 记住账号
                    </label>
                    <hr />
                    <a href="javascript:register();" id="register_btn" class=""><font color="#ff4500">注册账号</font></a>
                </div>
                <div class="form-group">
                    <input type="button" class="btn btn-success pull-right" value="Login " onclick="login()"/>
                </div>
            </div>
        </form>
    </div>
</div>
</body>
<script>
    //注册
    function register() {
        location.href="../page/zhucechai"
    }
    //登录
    function login() {
        var userAccount = $("#uname").val();
        var userPassword = $("#pwd").val();
        $.ajax({
            url:'../cjq/login',
            data:{
                userAccount:userAccount,
                userPassword:userPassword
            },
            type:'post',
            dataType:'json',
            success:function(data){
                if (data.code==0){
                    alert(data.msg)
                    location.href="../page/zhuye"
                }else{
                    alert(data.msg)
                }
            }
        })
    }
</script>
</html>